<template>
  <div class="app-container">
    <el-tabs v-model="activeName" type="card" @tab-remove="removeTab" @tab-click="tabclick">
      <el-tab-pane label="机房巡检记录" name="1">
        <template v-if="activeName === '1'">
          <Leftindex></Leftindex>
        </template>
      </el-tab-pane>
      <template v-if="tabIndex">
        <el-tab-pane :label="title" name="2" closable>
          <template v-if="activeName === '2'">
            <AddLeft :title="title" :rowObj="rowObj" @quit="removeTab"></AddLeft>
          </template>
        </el-tab-pane>
      </template>
    </el-tabs>
  </div>
</template>

<script>
export default {
  name: "computerRoom",
  components: {
    Leftindex: () => import('./Leftindex/index.vue'),
    AddLeft: () => import('./Leftindex/form/addbaseValue.vue'),
  },
  data () {
    return {
      activeName: '1',
      tabIndex: false,
      rowObj: {},
      title: ''
    };
  },
  created () {
  },
  methods: {
    tabclick () {
      if (this.activeName === '2') {
        return
      }
      this.tabIndex = false
      this.rowObj = {}
    },
    removeTab () {
      this.tabIndex = false
      this.activeName = '1'
    },
  }
};
</script>
